<?php

class StaticController extends Zend_Controller_Action
{

	public function preDispatch()
	{
		parent::preDispatch();
	}


	public function contactAction()
	{
		      echo  $this->_request->getParam('lang');
		$this->view->Title = "Связь с нами";
		if ($this->_request->isPost())
		{
			$Email = $this->_request->getParam('email','');
			$Name = $this->_request->getParam('name','');
			$Text = $this->_request->getParam('message','');

			if (mb_strlen($Text)==0 || mb_strlen($Name)==0 || mb_strlen($Email)==0)
			{
				return true;
			}


			$_subject = 'Мебель';
			$_body = "Сообщение от:  $Name <$Email> \n\r " . $Text;
			$_fromName = $Name;
			$_fromEmail = "admin@shels-mebel.com";

			$_toEmail = "levio.it@gmail.com";
			$_toName = 'Shels';


			$_subject = iconv('utf-8', 'cp1251', $_subject);
			$_body = iconv('utf-8', 'cp1251', $_body);
			$_fromName = iconv('utf-8', 'cp1251', $_fromName);
			$_toName = iconv('utf-8', 'cp1251', $_toName);

			$mail = new Zend_Mail('windows-1251');
			$mail->setBodyText($_body)
        			->addTo($_toEmail, iconv('utf-8', 'cp1251', $_toName))
		        	->setSubject($_subject)
			        ->setFrom($_fromEmail, $_fromName);
			        
			$result = $mail->send();
echo "Сообщение было успешно отправлено!<br />";
		}


	}
	public function aboutAction()
	{
		$this->view->Title = "About us";
	}



}

